package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller;

import java.sql.ResultSet;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.News;

public class NewsMaker {

	public News makeNews(ResultSet rs) {

		String from = null;
		String to = null;
		String title = null;
		String message = null;
		String rfcID = null;
		String know = null;

		try {
			
			from = rs.getString(News.TC_FROM);
			to = rs.getString(News.TC_TO);
			title = rs.getString(News.TC_TITLE);
			message = rs.getString(News.TC_MESSAGE);
			rfcID = rs.getString(News.TC_RFC_ID);
			know = rs.getString(News.TC_KNOWN);
			
		} catch (Exception e) {
			return new News("unknow", "you", "unknow", "unknow", "unknow", "false");
		}

		return new News(from, to, title, message, rfcID, know);
	}

}
